package com.tarena.demo.luban.all.main.rpc;

import com.tarena.demo.luban.all.main.service.StockService;
import com.tarena.demo.luban.protocol.stock.param.StockReduceCountParam;
import com.tarena.luban.demo.stock.api.StockApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component(value = "stockRpcImpl")
public class StockRpcImpl implements StockApi {
    @Autowired
    private StockService stockService;

    @Override
    public void StockDelete(Integer reduceStock, String productCode, String orderSn) {
        StockReduceCountParam stockReduceCountParam = new StockReduceCountParam();
        stockReduceCountParam.setReduceCount(reduceStock);
        stockReduceCountParam.setProductCode(productCode);
        stockReduceCountParam.setOrderSn(orderSn);
        stockService.reduceCommodityCount(stockReduceCountParam);
    }
}
